home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_222 / plplot / src / source.zoo / strpos.c < prev    next >
C/C++ Source or Header  |  1989-05-15  |  487b  |  20 lines

  1. /* Searches string str for first occurence of character chr.  If found */
  2. /* the position of the character in the string is returned (the first  */
  3. /* character has position 0).  If the character is not found a -1 is   */
  4. /* returned. */
  5.  
  6. #include "plplot.h"
  7. #include <stdio.h>     /* Needed to define NULL */
  8. #include <string.h>
  9.  
  10. int strpos(str,chr)
  11. char *str,chr;
  12. {
  13.     char *temp;
  14.  
  15.     if ( (temp = strchr(str,chr)) != NULL)
  16.         return(temp - str);
  17.     else
  18.         return(-1);
  19. }
  20.